package com.heo.music.player.auth;

import com.heo.music.player.entity.UserInfo;

/**
 * created on 2023-06-08 11:21
 *
 * @author 星天无极
 **/
public class UserInfoContextHolder {

    private static final ThreadLocal<UserInfo> USER_THREAD_LOCAL = new ThreadLocal<>();

    public static UserInfo getUserInfo() {
        return USER_THREAD_LOCAL.get();
    }

    public static void setUserInfo(UserInfo userInfo) {
        USER_THREAD_LOCAL.set(userInfo);
    }

    public static void clear() {
        USER_THREAD_LOCAL.remove();
    }
}
